package com.my.mail2;


import com.my.mail2.loadblanch.ILoadBalance;
import com.my.mail2.model.Email2;
import com.my.mail2.service.IEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private ILoadBalance strategy;
    @PostMapping
    public boolean healthCheck(@RequestBody Email2 email) {
        IEmailService service = strategy.select();
        return service.sendEmail(email);
    }
}
